package com.lemons.hackaton.algorithm;

public class Activity extends com.lemons.hackaton.obj.Activity {
	
	private Integer currentOpenHours;
	private Integer currentMaintenanceHours;
	private Boolean open;
	
	public void setFields(com.lemons.hackaton.obj.Activity activity){
		this.setCapacity(activity.getCapacity());
		this.setContinuousOpenHours(activity.getContinuousOpenHours());
		this.setMaintenanceHours(activity.getMaintenanceHours());
		this.setMinNoOfParticipants(activity.getMinNoOfParticipants());
		this.setTicketPrice(activity.getTicketPrice());
		this.setName(activity.getName());
	}
	
	public Boolean needsMaintenance(){
		return currentOpenHours == getContinuousOpenHours();
	}
	
	public Boolean needsToBeReopened(){
		return currentMaintenanceHours == getMaintenanceHours();
	}
	
	public void closeForMaintenance(){
		//System.out.println("Closing " + getName() + " for maintenance");
		open = false;
		currentOpenHours = 0;
	}
	
	public void openForPersons(){
		//System.out.println("Opening " + getName());
		open = true;
		currentMaintenanceHours = 0;
	}
	
	public Boolean isOpen() {
		return open;
	}

	public void setOpen(Boolean open) {
		this.open = open;
	}

	public Integer getCurrentOpenHours() {
		return currentOpenHours;
	}
	
	public void setCurrentOpenHours(Integer currentOpenHours) {
		this.currentOpenHours = currentOpenHours;
	}
	
	public Integer getCurrentMaintenanceHours() {
		return currentMaintenanceHours;
	}
	
	public void setCurrentMaintenanceHours(Integer currentMaintenanceHours) {
		this.currentMaintenanceHours = currentMaintenanceHours;
	}

	@Override
	public String toString() {
		return "Activity [name=" + getName() + ", capacity=" + getCapacity()
				+ ", minNoOfParticipants=" + getMinNoOfParticipants()  
				+ ", currentOpenHours=" + currentOpenHours + ", continuousOpenHours="
				+ getContinuousOpenHours() + ", currentMaintenanceHours=" + currentMaintenanceHours + ", maintenanceHours="
				+ getMaintenanceHours() + "]";
	}
}
